<script src="/public/library/jquery/jquery-tooltip/jquery.tooltip.js" type="text/javascript"></script>
<script src="/public/library/hvn/place.js" type="text/javascript"></script>
<script src="/public/library/jquery/jquery.form.js" type="text/javascript"></script>
<link rel="stylesheet" href="/public/library/jquery/jquery-tooltip/jquery.tooltip.css" />
<!--link rel="stylesheet" href="/public/library/jquery/jquery-tooltip/screen.css" />
<script src="/public/library/jquery/jquery-tooltip/lib/jquery.bgiframe.js" type="text/javascript"></script>
<script src="/public/library/jquery/jquery-tooltip/lib/jquery.dimensions.js" type="text/javascript"></script>

<script src="/public/library/jquery/jquery-tooltip/chili-1.7.pack.js" type="text/javascript"></script-->
<?
	$sess = new Zend_Session_Namespace(CLU_NS);
?>
<script type="text/javascript">
	$(function(){
		bulkModule("bulk-form", "place-row-", "place-status-", "placeIdClass");
		$('a.placeToolTip').tooltip({ 
            track: true, 
            delay: 0, 
            showURL: false, 
            opacity: 1, 
            fixPNG: true, 
//            showBody: " - ", 
            bodyHandler: function() { 
//        		return $($(this).attr("href")).html();
                txt = $(this).parent().find('span.tipSpan').html();
                return txt; 
   			}, 
            fade: 250, 
            extraClass: "nodePreview", 
   		});
	});
	
</script>
<div class="white_bg">
<br/>
<b> Search results for admin. If you want a normal view, log out and search again </b>
<hr/>
<br/><br/>


<div style="width:100%;float: right" id = "paging">
<?
$pageCount = ceil($this->viewParams['paginator']->getTotalItemCount()/$this->viewParams['paginator']->getItemCountPerPage());
?>
<? if ($pageCount > 1) :?>
	<?= $this->paginationControl($this->viewParams['paginator'], 'Sliding', '/modules/common/views/scripts/commonTheme/commonLang/common/clu-pagination-control.phtml',
							    array('searchUrl' => $this->viewParams['searchUrl'])); ?>
<?endif ?>
</div>
<div class="clear"></div>
<br><br>
<div class="clear"></div>

<form id ="bulk-form" action="/<?=$sess->viewLang?>/place/ajax/bulk-place" method="POST">

<table border = '1'>
    <tr>
        <td></td>
        <td><?=t(27) ?></td>
	    <td><?=t(810) ?></td>
	    <td><b><?=t(770) ?></b>(<?=t(771) ?>)</td>
	    <!--<td><?=t(771) ?></td>-->
		<td><b><?=t(816) ?></b>(rtype)</td>
		<!--<td><?=t(764) ?></td>-->
		<td><?=t(2) ?></td>
		<td><?=t(29) ?></td>
		<!--<td></?=t(774) ?></td>-->
        <td>Posterid</td>
	</tr>
    <?foreach ($this->viewParams['pList'] as $place):?>
    <?$metaData = unserialize($place['metadata']);?>
    <tr id="place-row-<?= $place['id'] ?>">
        <td width="2%"><input class="placeIdClass" value="<?=$place['id'] ?>" id="edit-place-<?=$place['id'] ?>" name="places[<?=$place['id'] ?>]" type="checkbox" /></td>
        <td width="2%"><?=$place['id'] ?></td>
        <td width="10%">
        <a  class="placeToolTip" title="<?=str_first_words(strip_tags($place['desc']), 0, 300) ?>" href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'view'))?>?id=<?=$place['id']?>"><?= $place['name']?></a>
        <span style="display:none" class="tipSpan">
        	<span style="float:left;padding-right:10px">
            <img src="/public/themes/prime/images/articles/HCM.jpg"/>
            </span>
            
            <?$a =str_first_words(strip_tags($place['desc'], 30)) ;?>
            <?if (strlen($a) > 0) :?>
            <?=$a ?>
            <?else:?>
            <?=t(137) ?>
            <?endif?>
            
            <span style="clear:both;display:block;text-align:right;padding-top:5px"> 
            <b><?=t(83) ?></b> : <?=$place['poster_id'] ?>
            </span>
        </span>
        </td>
        <td width="20%"> 
        	<b><?= $metaData['city_name']?></b>(<?if(isset($metaData['district_name'])) :?><?= $metaData['district_name']?><?endif?>)
        </td>
        <td width="20%"> <b>
        <?if(isset($metaData['type_name'])) :?><?=$metaData['type_name'] ?> <?endif?></b> (<?=($metaData['rtype_name'])?>)
        </td>
        <!--<td width="15%"> <b><?= $place['fee_currency']?> <?= $place['fee']?>/<?= $place['fee_basis']?></b></td>-->
        <td width="5%" id= "place-status-<?=$place['id'] ?>"> <b><?=$place['status']?> </b></td>
        <td width="25%"><a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'edit'))?>?id=<?=$place['id']?>"><?=t(38) ?></a>|
        <a href="javascript:void()" name="place-delete-<?=$place['id']?>"><?=t(31) ?></a>
        <span id="delete-error-<?=$place['id']?>"></span>|<a href="javascript:void()" name="set-status-deleted-<?=$place['id']?>"><?=t(32) ?></a><span id="set-status-deleted-<?=$place['id']?>"></span>
        | <a href="<?=$this->hvnUrl(array('module' => 'article', 'action' => 'translate'))?>?id=<?=$place['article_id']?>&to=en"><?=t(90)?></a>
        
        </td>
         
        <td width="10%">
        <?= $place['poster_id']?>
        </td>
        
    </tr>
    <?endforeach?>
</table>
    
<br>
<br />
<div style="width:100%;float: right" id = "paging">
<?
$pageCount = ceil($this->viewParams['paginator']->getTotalItemCount()/$this->viewParams['paginator']->getItemCountPerPage());
?>
<? if ($pageCount > 1) :?>
	<?= $this->paginationControl($this->viewParams['paginator'], 'Sliding', '/modules/common/views/scripts/commonTheme/commonLang/common/clu-pagination-control.phtml',
							    array('searchUrl' => $this->viewParams['searchUrl'])); ?>
<?endif ?>

</div>
<div class="clear"></div>
<br/>
<br/>
<div class="clear"></div>
<div  style="background-color:#EEEEEE">
<?=t(30) ?>: 
<select name='bulkaction' id ="bulk" >
<?if(true): //TODO: isadmin()?>
<option value='delete'> <?=t(31) ?> </option>
<?endif ?>
<option value='status'> <?=t(32) ?> </option>
</select>

<select name='changestatus' id ="changeStatus" style=" display:none">
<option value='featured'> <?=t(33) ?> </option>
<option value='published'> <?=t(34) ?> </option>
<option value='queued'> <?=t(35) ?> </option>
<option value='unpublished'> <?=t(36) ?> </option>
<option value='deleted'> <?=t(37) ?> </option>
</select>
<input type="submit" value="Apply" id="bulk-submit" name="bulkPlace"/>
</div>
</form>
</div>